export function escapeHtml(text?: string) {
    const map: Record<string, string> = {
        "&": "&amp;",
        "<": "&lt;",
        ">": "&gt;",
        '"': "&quot;",
        "'": "&#039;",
    };

    return text
        ? text.replace(/[&<>"']/g, function (m) {
            return map[m];
        })
        : "";
}


export function htmlcontext(text?: string) {
    if (text) {
        const r = /<[^>]+>/g
        return text.replace(r, e => {
            return ''
        })
    } else {
        return ''
    }
}